<?php /*a:7:{s:58:"E:\code\jiaoyou\application\admin\view\area\area_list.html";i:1598939753;s:57:"E:\code\jiaoyou\application\admin\view\public\header.html";i:1598939754;s:54:"E:\code\jiaoyou\application\admin\view\public\css.html";i:1598939754;s:53:"E:\code\jiaoyou\application\admin\view\public\js.html";i:1598939754;s:58:"E:\code\jiaoyou\application\admin\view\public\tophead.html";i:1598939754;s:54:"E:\code\jiaoyou\application\admin\view\public\top.html";i:1598939753;s:57:"E:\code\jiaoyou\application\admin\view\public\footer.html";i:1598939753;}*/ ?>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="renderer" content="webkit">
<meta http-equiv="Cache-Control" content="no-siteapp" />
<title>后台系统</title>
<!--[if lt IE 9]>
<meta http-equiv="refresh" content="0;ie.html" />
<![endif]-->
<link rel="stylesheet" type="text/css" href="http://jiaoyou.com\/style/admin/css/bootstrap.min.css" />
<link rel="stylesheet" type="text/css" href="http://jiaoyou.com\/style/admin/css/font-awesome.min.css" />
<link rel="stylesheet" type="text/css" href="http://jiaoyou.com\/style/admin/css/animate.min.css" />
<link rel="stylesheet" type="text/css" href="http://jiaoyou.com\/style/admin/css/style.min.css" />
<link rel="stylesheet" type="text/css" href="http://jiaoyou.com\/style/admin/css/ffxiang.css" />
<link rel="shortcut icon" href="http://jiaoyou.com\/style/admin/img/favicon.ico">
    <script type="text/javascript" src="http://jiaoyou.com\/style/admin/js/jquery.min.js"></script>
<script type="text/javascript" src="http://jiaoyou.com\/style/admin/js/bootstrap.min.js"></script>
    <script type="text/javascript" src="http://jiaoyou.com\/style/layui/layui.js"></script>
    <link rel="stylesheet" type="text/css" href="http://jiaoyou.com\/style/layui/css/layui.css" />
</head>
<style type="text/css">
    #des, #des input {
        width: 40px;
        text-align: center;
    }

    #id {
        width: 78px;
    }

    .bs-checkbox {
        width: 36px;
        height: 40px
    }

    .fixed-table-toolbar .columns, .fixed-table-toolbar .search {
        margin-left: 0px;
        margin-top: 0px
    }

    #title span {
        float: right;
    }

    .btn-active {
        background: #1ab394;
        color: #fff
    }
</style>
<body class="gray-bg">
<div class="wrapper wrapper-content">
    <div class="ibox float-e-margins">
        <?php 
$controller=strtolower(request()->controller());
$action=strtolower(request()->action());
$adminCtegory=db('category')->where(['controller'=>$controller,'function'=>$action])->cache(_cache('db'))->find();
$admin = Session::get('admin', 'mmjtAdmin');

if ($admin['id'] != 1 && $admin['type'] != 1) {
  $auth_visit = Db::name('admin_type')->where(['id' => $admin['type']])->value('data');
  $auth_visit = json_decode($auth_visit, true);
}else{
  $auth_visit = Db::name('category')->column('id');
}
if($adminCtegory){
	$adminCtegoryTid=db('category')->where(['tid'=>$adminCtegory['id'],'hideright'=>1])->order('des asc,id asc')->cache(_cache('db'))->select();
}else{
  $adminCtegoryTid=[];
}
 ?>
<div class="">
	<?php if(is_array($adminCtegoryTid) || $adminCtegoryTid instanceof \think\Collection || $adminCtegoryTid instanceof \think\Paginator): $i = 0; $__LIST__ = $adminCtegoryTid;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$v): $mod = ($i % 2 );++$i;
  $get=$v['get'];
  $geturl=[]; 
  if($get){
    if(strstr($get,"|")){
      $tidexplode=explode("|",$get);
      foreach($tidexplode as $va){
        $geturl[$va]=input($va);
      }
    }else{
        $geturl[$get]=input($get);
    }
  }
  $geturl['url']='-1';
  $url=url($v['controller'].'/'.$v['function'],$geturl);
   if(in_array($v['id'],$auth_visit)): ?><a onclick="add('<?php echo htmlentities($url); ?>')" href="javascript:void(0);" class="btn btn-primary "><?php echo htmlentities($v['title']); ?></a><?php endif; ?>
  <?php endforeach; endif; else: echo "" ;endif; ?>
</div>
<script type="text/javascript">
function add(url){
        layer.open({
          type: 2,
          title: '提示',
          shadeClose: false,
          shade: 0.2,
          area: ['90%', '90%'],
          skin:'shangchuantup',
          shift:-1,
          content: url,
          scrollbar: false,
          moveType: 1,
          moveOut: true
        }); 
}
</script>
        <div class="ibox-title">
<h5>
<?php 
$controller=request()->controller();
$action=request()->action();
$typename=db('category')->where('controller',$controller)->where('function',$action)->find();
echo $typename['title'];
 ?></h5>
</div>
        <div class="ibox-content">
            <div class="row row-lg">

                <div style="display:block;clear: both;"></div>
                <div class="fixed-table-toolbar">

                </div>
                <div class="example">
                    <form class="form-horizontal" method="post">
                        <table id="table_area" data-toggle="table" data-striped="false">
                            <thead>
                            <tr>

                                <th >名称</th>
                                <th>名称首字母</th>
                                <th>热门</th>
                                <th>显示</th>
                                <th>管理</th>
                            </tr>
                            </thead>
                            <tbody>
                            <?php if(is_array($list) || $list instanceof \think\Collection || $list instanceof \think\Paginator): $i = 0; $__LIST__ = $list;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?>

                            <tr id="id_<?php echo htmlentities($vo['id']); ?>" class="class_0">
                                <td class="categoryTitle"><span class="space"></span><span style="cursor:pointer" onclick="op(this,<?php echo htmlentities($vo['id']); ?>)">[+]</span><?php echo htmlentities($vo['name']); ?></td>
                                <td><?php echo htmlentities($vo['first_char']); ?></td>
                                <td><?php if($vo['is_hot']): ?>是<?php else: ?>否<?php endif; ?></td>
                                <td><?php if($vo['is_show']): ?>是<?php else: ?>否<?php endif; ?></td>
                                <td>
                                    <div class="btn-group">
                                        <div data-toggle="dropdown" class="btn btn-primary btn-xs dropdown-toggle">
                                            操作 <span class="caret"></span>
                                        </div>
                                        <ul class="dropdown-menu">
                                            <li>
                                                <a onClick="add('<?php echo url('Area/areaAdd',['id'=>$vo['id'],'url'=>-1]); ?>')">修改</a>
                                            </li>
                                            <li class="divider"></li>
                                            <li><a onclick="del('<?php echo htmlentities($vo['id']); ?>')">删除</a></li>
                                        </ul>
                                    </div>
                                </td>
                            </tr>
                            <?php endforeach; endif; else: echo "" ;endif; ?>
                            </tbody>
                        </table>
                    </form>
                </div>
            </div>



        </div>
    </div>
</div>
     
    <script type="text/javascript" src="http://jiaoyou.com\/style/admin/js/content.min.js"></script>
    <link rel="stylesheet" type="text/css" href="http://jiaoyou.com\/style/admin/plugins/sweetalert/sweetalert.css" />
    <script type="text/javascript" src="http://jiaoyou.com\/style/admin/plugins/sweetalert/sweetalert.min.js"></script>
    <script type="text/javascript" src="http://jiaoyou.com\/style/admin/plugins/layer/layer.js"></script>
    <script type="text/javascript" src="http://jiaoyou.com\/style/admin/js/ffxiangIndex.js"></script>
    <script type="text/javascript" src="http://jiaoyou.com\/style/admin/js/common.js"></script>
</body>
</html>
<link rel="stylesheet" type="text/css" href="http://jiaoyou.com\/style/admin/plugins/bootstrap/bootstrap-table.min.css" />
<script type="text/javascript" src="http://jiaoyou.com\/style/admin/plugins/bootstrap/bootstrap-table.min.js"></script>
<script type="text/javascript" src="http://jiaoyou.com\/style/admin/plugins/bootstrap/bootstrap-table-zh-CN.min.js"></script>
<script type="text/javascript">
    function add(url) {
        layer.open({
            type: 2,
            title: '内容管理',
            shadeClose: false,
            shade: 0.2,
            area: ['80%', '95%'],
            skin: 'shangchuantup',
            // shift:-1,
            content: url,
        });
    }


</script>

<script>
    function op(object,pid) {
        var tr_object= $(object).parent().parent();

        if ($(object).text() == "[+]") {
            $(object).text("[-]");

            if( $('tr').hasClass('class_'+pid)){
                $('.class_'+pid).show();
                return;
            }

            $.ajax({
                url: "<?php echo url('area/getArea'); ?>",
                type: 'POST',
                dataType: 'JSON',
                data: {pid: pid},
                success: function (res) {
                    var json=eval("("+res+")")
                    if (json.status == 1) {
                        var data = json.data;
                        var html='';
                        var new_class = tr_object.attr('class')+' class_'+pid;
                        $(data).each(function (index,value) {
                            var url='<?php echo url('Area/areaAdd'); ?>';
                            var add_url=url+'?id='+value.id+"&url=-1";
                            var is_hot= value.is_hot==1?"是":"否";
                            var is_show= value.is_show==1?"是":"否";
                            var space = $(object).parent().children(".space").html()+"&nbsp;&nbsp;&nbsp;&nbsp;";
                            html +='<tr id="id_'+value.id+'" class="'+new_class+'">\n' +
                                '                                <td class="categoryTitle"><span class="space">'+space+'</span><span style="cursor:pointer" onclick="op(this,'+value.id+')">[+]</span>'+value.name+'</td>\n' +
                                '                                <td>'+value.first_char+'</td>\n' +
                                '                                <td>'+is_hot+'</td>\n' +
                                '                                <td>'+is_show+'</td>\n' +
                                '                                <td>\n' +
                                '                                    <div class="btn-group">\n' +
                                '                                        <div data-toggle="dropdown" class="btn btn-primary btn-xs dropdown-toggle">\n' +
                                '                                            操作 <span class="caret"></span>\n' +
                                '                                        </div>\n' +
                                '                                        <ul class="dropdown-menu">\n' +
                                '                                            <li>\n' +
                                '                                                <a onClick="add(\''+add_url+'\')">修改</a>\n' +
                                '                                            </li>\n' +
                                '                                            <li class="divider"></li>\n' +
                                '                                            <li><a onclick="del('+value.id+')">删除</a></li>\n' +
                                '                                        </ul>\n' +
                                '                                    </div>\n' +
                                '                                </td>\n' +
                                '                            </tr>';
                        });
                        tr_object.after(html);
                    }
                },
                error: function () {
                    layer.msg('网络错误', {icon: 2, time: 3000});
                }
            });

        } else {
            $(object).text("[+]");
            $('.class_'+pid).hide();
        }
    }
    function del(id){
        swal_del(id,"<?php echo url('AreaDel'); ?>", {title: '该内容'})
    }
</script>